<?php

namespace app\api\dao\admin\setting;

use app\api\common\dao\BaseDao;
use app\api\model\admin\setting\Upload;

class UploadDao extends BaseDao
{

    protected function setModel(): string
    {
        return Upload::class;
    }

    public function getUploadList(array $where, array $field, int $page = 0, int $limit = 0, array $with = [], $order = 'id DESC')
    {
        return $this->search($where)->field($field)->with($with)->when($page && $limit, function ($query) use ($page, $limit) {
            $query->page($page, $limit);
        })->order($order)->select()->toArray();
    }
}
